// Copyright (c) 2009 John Ehn, ExtremeSwank.com
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

using ExtremeSwank.OpenId.PlugIns.Discovery;

namespace ExtremeSwank.OpenId
{
    /// <summary>
    /// Interface used for Discovery plugins.
    /// Discovery plugins extend the OpenID Client to support additional identifier discovery methods.
    /// </summary>
    public interface IDiscovery
    {
        /// <summary>
        /// Human-readable name of plugin.
        /// </summary>
        string Name { get; }
        /// <summary>
        /// Parent <see cref="StateContainer" /> object.
        /// </summary>
        StateContainer Parent { get; }
        /// <summary>
        /// Method called during discovery process.
        /// </summary>
        /// <param name="content">HTTP response output from request.</param>
        /// <returns>An array of <see cref="DiscoveryResult"/> objects.</returns>
        DiscoveryResult[] Discover(string content);
        /// <summary>
        /// Method called prior to discovery process.  Accepts a claimed identifier and returns
        /// the normalized identifier, and an endpoint URL.
        /// </summary>
        /// <param name="openid">String containing claimed identifier.</param>
        /// <returns>A populated <see cref="NormalizationEntry"/> object.</returns>
        NormalizationEntry ProcessId(string openid);
        /// <summary>
        /// Based on discovery, returns highest protocol version supported by endpoint. Used by consumer
        /// to determine which version of protocol to use when connecting to Identity Provider.
        /// </summary>
        ProtocolVersion Version { get; }
    }

}
